package com.lidroid.xutils.sample.menuapp;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;

import com.lidroid.xutils.sample.R;
import com.lidroid.xutils.sample.menuapp.adaptor.StepsAdapator;
import com.lidroid.xutils.sample.menuapp.enty.Dish;
import com.lidroid.xutils.sample.menuapp.enty.Step;

public class DishDetailActivity extends Activity {
	private Context mContext;
	private ImageView stepImg;
	private TextView nameTv,burdenTv,introduceTv,stepContentTv;
	private ListView stepLv;
	private int dishId;
	private StepsAdapator dishAdapator;
	private  Step[]  stepsListData ;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.wangqu_dish_detail);		
		mContext=this.getApplicationContext();
		initViews();	
	}
	
	public void initViews() {
		dishAdapator=new StepsAdapator(getApplicationContext());
		Intent intent=getIntent();
		dishId= Integer.parseInt( intent.getStringExtra("id"));
		View headerView=LayoutInflater.from(mContext).inflate(R.layout.wangqu_dish_detail_header, null);
		nameTv=(TextView) headerView.findViewById(R.id.name_tv);
		introduceTv= (TextView) headerView.findViewById(R.id.introduce_tv);
		burdenTv=(TextView) headerView.findViewById(R.id.burden_tv);
		final Dish wangQuData = (Dish) intent
				.getSerializableExtra("wangquData");
		nameTv.setText(wangQuData.getName());
		introduceTv.setText(wangQuData.getTags());
		burdenTv.setText(wangQuData.getIngredients()+wangQuData.getBurden());
		stepLv=(ListView) findViewById(R.id.steps_lv);
		stepLv.addHeaderView(headerView);
		dishAdapator.BindData(wangQuData.getSteps());
		stepLv.setAdapter(dishAdapator);
		dishAdapator.notifyDataSetChanged();
		
	}
	
 
}

 
